package cn.tedu._04mybatis.mapper;

import cn.tedu._04mybatis.pojo.entity.Comment;
import cn.tedu._04mybatis.pojo.vo.Comment1;
import cn.tedu._04mybatis.pojo.vo.Comment2;
import cn.tedu._04mybatis.pojo.vo.ResultMapVO3;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CommentMapper {
    //@Insert("INSERT INTO comment(id, content, created, user_id, weibo_id) VALUES (#{id},#{content},#{created},#{userId},#{weiboId})")
    void InsertComment(Comment comment);

//    删除除数
    //@Delete("DELETE FROM comment WHERE id=#{id}")
    int deleteComment(Long id);

//    修改数据
    //@Update("UPDATE comment SET id=#{id},content=#{content},created=#{created},user_id=#{userId},weibo_id=#{weiboId} WHERE id=#{id}")
    int updateComment(Comment comment);

//    根据评论的Id查询用户的内容
    //@Select("SELECT content,user_id,weibo_id FROM comment WHERE id=#{Id}")
    Comment1 selectCommentById(Long Id);

//    根据微博的Id查询评论的内容用户的Id
    //@Select("SELECT content,user_id FROM comment WHERE weibo_id=#{weiboId}")
    List<Comment2> selectCommentByWeiboId(Long weiboId);

    ResultMapVO3 selectMap3(Long wid);
}
